# -*- coding: utf-8 -*-
"""group_cognize URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.conf.urls import include
from django.conf import settings
from django.conf.urls.static import static as static

import xadmin
from outlines.views import IndexView
from xadmin.plugins import xversion

from django_ueditor.views import get_ueditor_controller

xadmin.autodiscover()

# version模块自动注册需要版本控制的 Model
xversion.register_models()

urlpatterns = [
    url(r'^xadmin/', include(xadmin.site.urls)),
    url(r'^ueditor/', include('django_ueditor.urls')),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^ueditor_upload', get_ueditor_controller),
    url(r'^outlines/', include('outlines.urls', namespace='outlines')),
    url(r'^accounts/', include('accounts.urls', namespace='accounts')),
]
# 处理服务器文件
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
